import request from '@/utils/request'

// 获取横向课题列表
export function getHorizontalsList(params) {
    return request({
        url: '/horizontal/get/certification',
        method: 'post',
        data: params
    })
}

// 保存新的横向课题
export function saveHorizontal(horizontalData) {
    return request({
        url: '/horizontal/save',
        method: 'post',
        data: horizontalData
    })
}

// 根据ID删除横向课题
export function deleteHorizontal(id) {
    return request({
        url: `/horizontal/deleteById/${id}`,
        method: 'delete'
    })
}

// 根据特定条件查询横向课题
export function getHorizontals(horizontalQuery) {
    return request({
        url: '/horizontal/get/certification',
        method: 'post',
        data: horizontalQuery
    })
}

// 根据ID获取横向课题
export function getHorizontalById(id) {
    return request({
        url: `/horizontal/getById/${id}`,
        method: 'get'
    })
}

// 更新横向课题信息
export function updateHorizontal(horizontalData) {
    return request({
        url: '/horizontal/update',
        method: 'put',
        data: horizontalData
    })
}

// 根据多个ID批量查询横向课题
export function getHorizontalsByIds(ids) {
    return request({
        url: '/horizontal/getHorizontalByIds',
        method: 'post',
        data: ids
    })
}

// 导出横向课题资料（Excel格式）
export function exportHorizontals(exportRequest) {
    return request({
        url: '/horizontal/export',
        method: 'post',
        data: exportRequest,
        responseType: 'blob'  // 指定返回的数据类型为二进制流
    })
}
